<template>
  <div>
    <el-input :disabled="disabled" v-model="paramInfo" />
  </div>
</template>

<script>
export default {
  name: 'FlowParam',
  inject: ['getDataFromOthers'],
  props: {
    disabled: {
      type: Boolean,
      default: true
    },
    modelValue: {
      type: String,
      default: ''
    },
    flowParam: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      paramInfo: '-'
    };
  },
  watch: {
    modelValue: {
      handler(newVal) {
        if (newVal) {
          this.paramInfo = newVal;
        }
      },
      immediate: true
    },
    paramInfo(newVal) {
      this.$emit('update:modelValue', newVal);
    }
  },
  mounted() {
    if (this.getDataFromOthers && typeof this.getDataFromOthers == 'function' && this.getDataFromOthers() && this.getDataFromOthers().params) {
      this.paramInfo = this.getDataFromOthers().params[this.flowParam] ?? '-';
    }
  },
  methods: {}
};
</script>
